package cn.ipenta.jkb.utils;

import java.util.HashMap;
import java.util.Map;

public class JsonMapper {

	final static String STATUS = "status";
	final static String MESSAGE ="message";
	final static String DATA ="data";
	
	final static String STATUS_SUCCESS = "success";
	final static String STATUS_FAIL = "fail";
	
	public static <T> Map<String, Object> success(T t){
		
		Map<String, Object> map = new HashMap<>();
		map.put(STATUS, STATUS_SUCCESS);
		map.put(MESSAGE, "");
		map.put(DATA, t);
		return map;
	}

	public static <T> Map<String, Object> fail(T message){
		
		Map<String, Object> map = new HashMap<>();
		map.put(STATUS, STATUS_FAIL);
		map.put(MESSAGE, message);
		return map;
	}
	


}
